package com.linzx.markdown.entity;

import javax.swing.table.DefaultTableModel;
import java.util.LinkedList;
import java.util.List;

/**
 * @author avicomlin
 * @Description: 数据中心
 * @date 2021/1/17
 */
public class DataCenter {
    public static String FILE_NAME;

    public static String SELECT_TEXT;

    public static List<NoteDate> LIST = new LinkedList<>();


    public static String[] HEADS = {"标题", "备注", "文件名", "代码块"};

    public static DefaultTableModel TABLE_MODEL = new DefaultTableModel(null, HEADS);

    public static String[] convert(NoteDate date) {
        return new String[] {date.getTitle(), date.getContext(), date.getFileName(), date.getName()};
    }


    private DataCenter() {
    }


    public static void setFileName(String fileName) {
        FILE_NAME = fileName;
    }


    public static void setSelectText(String selectText) {
        SELECT_TEXT = selectText;
    }

    public static void clear() {
        LIST.clear();
        TABLE_MODEL.setDataVector(null, HEADS);
    }

}
